class Base {
    int a;
    int b;

    public static void print() {
        System.out.println("hello");
    }

    public Base(int a, int b) {
        this.a = a;
        this.b = b;
    }
}

class A {
    public String toString() {
        return "111";
    }
}

public class Derived extends Base {
    int a;
    int c;
    String name;

    public void method() {
        super.a = 10;
        b = 20;
        c = 30;
        System.out.println(super.a);
        System.out.println(a);
        System.out.println(b);
        System.out.println(c);
    }

    public Derived(int a, int b) {
        super(a, b);//必须放在第一行，先初始化父类的对象
        this.name = "Jack";
    }

    public static void main1(String[] args) {

        Derived derived = new Derived(1, 2);
        derived.method();

//        Base base = new Base();
//        System.out.println(base.a);
    }

    public static void main2(String[] args) {
        //打印会去调用toString -- 在父类中重写了
        System.out.println(new A());

        //静态里不能用this也不能用super
    }

    //super和
    public static void main(String[] args) {

    }
}